
//var getProvince = function(obj) {
  //  jQuery.ajax({
    //    url: "/app_user/address_cascade",
      //  type: "GET",
        //data: {
          //  "parent_id": 0
        //},
        //dataType: "json",
        //success: function(json) {
          //  var provinceData = json.data;
           // var a = json.acceptAddress;
            //if (provinceData.length == 1) {
              //  var option = document.createElement("option");
               // jQuery("#province").append(option);
                //option.value = provinceData[0].id;
                //option.text = provinceData[0].cityName;
           // } else {
             //   for (var i = 0; i < provinceData.length; i++) {
               //     var option = document.createElement("option");
                 //   jQuery("#province").append(option);
                   // option.value = provinceData[i].id;
                    //option.text = provinceData[i].cityName;
               // } 
            //}
        //}
    //});
//};
var getCity = function(memberProvinceId) {
    jQuery('#city option').remove();
    jQuery('#county option').remove();
    if(memberProvinceId==-1){
    	 var option = document.createElement("option");
         jQuery("#city").append(option);
         option.value = "-1";
         option.text = "-请选择-";
    }
    //jQuery('#county option').remove();
    jQuery('#schoolId option').remove();
    var option = document.createElement("option");
    jQuery("#schoolId").append(option);
    option.value = "-1";
    option.text = "-请选择-";
    jQuery.ajax({
        url: "/app_user/city_cascade?time=" + new Date().getTime(),
        type: "GET",
        data: {
            "id": memberProvinceId
        },
        dataType: "json",
        success: function(json) {
            var cityData = json.data;
            if (cityData != null) {
                for (var i = 0; i < cityData.length; i++) {
                    if (i == 0) {
                        var option = document.createElement("option");
                        jQuery("#city").append(option);
                        option.value = "-1";
                        option.text = "-请选择-";
                    }
                    var option = document.createElement("option");
                    jQuery("#city").append(option);
                    option.value = cityData[i].id;
                    option.text = cityData[i].cityName;
                }
            }
            
        }
    });
};
var getSchool = function(cityId) {
    jQuery('#schoolId option').remove();
    //jQuery('#county option').remove();
    jQuery.ajax({
        url: "/app_user/show_school?time=" + new Date().getTime(),
        type: "GET",
        data: {
            "id": cityId
        },
        dataType: "json",
        success: function(json) {
            var schoolData = json.data;
            if (null !=schoolData ) {
                for (var i = 0; i < schoolData.length; i++) {
                    if (i == 0) {
                        var option = document.createElement("option");
                        jQuery("#schoolId").append(option);
                        option.value = "-1";
                        option.text = "-请选择-";
                    }
                    var option = document.createElement("option");
                    jQuery("#schoolId").append(option);
                    option.value = schoolData[i].id;
                    option.text = schoolData[i].schoolName;
                }
            }
            
        }
    });
};
var getCounty = function(cityId) {
    jQuery('#county option').remove();
    jQuery.ajax({
        url: "/app_user/city_cascade?time=" + new Date().getTime(),
        type: "GET",
        data: {
            "id": cityId
        },
        dataType: "json",
        success: function(json) {
            var countyData = json.data;
            if (countyData !=null) {
                for (var i = 0; i < countyData.length; i++) {
                    if (i == 0) {
                        var option = document.createElement("option");
                        jQuery("#county").append(option);
                        option.value = "-1";
                        option.text = "-请选择-";
                    }
                    var option = document.createElement("option");
                    jQuery("#county").append(option);
                    option.value = countyData[i].id;
                    option.text = countyData[i].cityName;
                }
            }
        }
    });
};